import request from '@/utils/request';
import {getEW} from "@/utils/utils";


export async function query({...resetParams}) {
  return request(`/accounts`,{
    method:'GET',
    params:{
      ...resetParams,
      order_direction:'desc',
      company_ids:getEW(resetParams.company_ids),
    }
  });
}


export async function remove({id}) {
  return request(`/accounts/${id}`, {
    method: 'DELETE',
  });
}


export async function add(restParams) {
  return request(`/accounts`, {
    method: 'POST',
    data: {
      ...restParams,
    },
  });
}

export async function edit({id,...restParams}) {
  return request(`/accounts/${id}`, {
    method: 'PUT',
    data: {
      ...restParams,
    },
  });
}
export async function exportEXCEL({id,...restParams}) {
  return request(`/account_files`, {
    method:'GET',
    params:{
      ...restParams,
    order_direction:'desc'
    },
  });
}
